import request from '@/axios/request';

// 获取包材列表
export function getMaterialList(params: {
  search?: string
  page?: number
  page_size?: number
}) {
  return request({
    url: '/package-material/basic/list',
    method: 'get',
    params
  })
}

// 新增包材
export function addMaterial(data: {
  code: string
  type: string
  description?: string
  unit: string
  operator?: string
}) {
  return request({
    url: '/package-material/basic/add',
    method: 'post',
    data
  })
}

// 更新包材
export function updateMaterial(data: {
  code: string
  type: string
  description?: string
  unit: string
  operator?: string
}) {
  return request({
    url: '/package-material/basic/update',
    method: 'put',
    data
  })
}

// 删除包材
export function deleteMaterial(code: string, operator?: string) {
  return request({
    url: `/package-material/basic/delete/${code}`,
    method: 'delete',
    params: { operator }
  })
} 